Skip to content

Stamp CLAUDE_CODE_ENTRYPOINT so phone-started sessions appear in the resume pickers - #108

Open
jankarres wants to merge 1 commit into
shellular-org:mainfrom
jankarres:jan/claude-session-visibility
Open

Stamp CLAUDE_CODE_ENTRYPOINT so phone-started sessions appear in the resume pickers#108
jankarres wants to merge 1 commit into
shellular-org:mainfrom
jankarres:jan/claude-session-visibility

Conversation

@jankarres

Copy link
Copy Markdown

Sessions started from the app are written to ~/.claude/projects like any other, and then neither /resume nor the VS Code session list will show them, because the Agent SDK stamps them sdk-ts and both pickers filter that out. This sets CLAUDE_CODE_ENTRYPOINT=shellular when the host spawns the Claude Code adapter, which is all it takes. Closes #107.

ClaudeCode overrides spawnEnvOverride(), the hook ACP already provides for exactly this, and returns the value only when the operator has not exported one of their own. That is deliberate rather than lazy: spawnAgentProcess merges the descriptor env over process.env, so putting it in BUILTIN_AGENT_DESCRIPTORS would silently beat anyone who sets it themselves. The SDK defaults its own value the same way.

The value is not arbitrary. cli is rewritten to sdk-cli under the SDK and lands back on the filter list; anything else outside sdk-cli, sdk-ts and sdk-py works, and shellular also labels the transcript with where the session came from.

How I checked it

Built the CLI, pointed it at a local central and relay, paired the app and opened the agent's session list, since that is what makes the host spawn the adapter in the first place. Then read the environment out of /proc rather than trusting the code.

With nothing exported, the host process has no CLAUDE_CODE_ENTRYPOINT and the adapter underneath it comes up with shellular. Restart the same host with CLAUDE_CODE_ENTRYPOINT=operator-choice and the adapter comes up with operator-choice, so exporting your own still wins.

tsc --noEmit and biome check are clean, and there are no tests in the package to add to. CI here only checks that cli/schema.sql is in sync; nothing in this change touches a migration, and regenerating it leaves the file untouched.

Before you merge

shellular as the value is the part I would expect an opinion on, since it is what ends up in every transcript record. Any string outside the three filtered ones does the job.

If anything here should be different, tell me and I will take care of it.

Claude Code records an entrypoint on every transcript record, and both of its
resume pickers drop the ones that look machine-driven: /resume in the CLI and
the session list in the VS Code extension each filter sdk-cli, sdk-ts and
sdk-py. The Agent SDK that the ACP adapter runs on stamps sdk-ts unless the
variable is already set, so a session started from the phone is written to
~/.claude/projects like any other and is then invisible at the desk, which is
where you would want to pick it up.

Set CLAUDE_CODE_ENTRYPOINT=shellular at spawn time, and only when the operator
has not set one, the way the SDK itself does it. Baking it into the descriptor
would win over an inherited value, since spawnAgentProcess merges the
descriptor env over process.env.

The value matters: cli is rewritten to sdk-cli when Claude Code runs under the
SDK and is filtered again. Anything outside that set works, and shellular also
labels the transcript by where it came from.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show Claude Code sessions started from the phone in /resume and the VS Code session list

1 participant